//
//  LeaksViewController.m
//  TimerInvalidate
//
//  Created by kang on 2018/7/13.
//  Copyright © 2018年 fuyunhe. All rights reserved.
//

#import "LeaksViewController.h"
#import "WeakProxy.h"


@interface LeaksViewController ()

@property(nonatomic,strong)NSTimer *timer;

@property(nonatomic,strong)WeakProxy *proxy;

@end

@implementation LeaksViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    /**
     
     内存泄漏检测第三方工具    MLeaksFinder
     
     */
    
    self.proxy = [WeakProxy alloc];
    self.proxy.target = self;
    
    self.timer = [NSTimer timerWithTimeInterval:1.0 target:self.proxy selector:@selector(fire) userInfo:nil repeats:YES];
    
    [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
}

-(void)fire{
    
    NSLog(@"fire...");
    
}

-(void)dealloc{
    
    [self.timer invalidate];
    
    self.timer = nil;
    
    NSLog(@"dealloc");
}

@end
